package com.zj.util;

public enum ReturnInfoStatus {

    Are("C01", "存在满足条件的登记信息"),

    Query("C02", "查询失败"),

    No("C03", "无登记信息");

    private String value;
    private String desc;


    ReturnInfoStatus(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public ReturnInfoStatus setValue(String value) {
        this.value = value;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public ReturnInfoStatus setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    private ReturnInfoStatus(String desc) {
        this.desc = desc;
    }

    public static ReturnInfoStatus parse(String value) {
        if (null == value) {
            return null;
        }
        ReturnInfoStatus[] coll = values();
        for (ReturnInfoStatus item : coll) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    public static ReturnInfoStatus parseDesc(String desc) {
        if (null == desc) {
            return null;
        }
        ReturnInfoStatus[] coll = values();
        for (ReturnInfoStatus item : coll) {
            if (item.getDesc().equals(desc)) {
                return item;
            }
        }
        return null;
    }

    public static String getDesc(String value) {
        for (ReturnInfoStatus returnInfoStatus : ReturnInfoStatus.values()) {
            if (returnInfoStatus.getValue().equals(value)) {
                return returnInfoStatus.getDesc();
            }
        }
        return null;
    }
}
